<template>
  <el-button :size="size" :type="type" :loading="loading" @click="click">
    <slot></slot>
  </el-button>
</template>
<script>
export default {
  name: 'loadingButton',
  props: {
    size: {
      type: String,
      default: 'medium',
    },
    type: {
      type: String,
      default: 'default',
    },
  },
  data() {
    return {
      loading: false,
    };
  },
  methods: {
    click() {
      this.loading = true;
      this.$emit('click', () => {
        this.loading = false;
      });
    },
  }
}
</script>